package com.etc.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.etc.dao.RecordMapper;
import com.etc.entity.LayUiData;
import com.etc.entity.Record;
import com.etc.service.RecordService;

@Service
public class RecordServiceImpl implements RecordService {

	@Autowired
	private RecordMapper rs;
	
	@Override
	public LayUiData<Record> getRecomName(int page, int limit, String strLike) {
		// TODO Auto-generated method stub
		int start = (page - 1) * limit;
		LayUiData<Record> laydata = new LayUiData<Record>();
		laydata.setCode(0);
		laydata.setMsg("");
		List<Record> list = rs.getRecomName(start, limit, strLike);
		laydata.setCount(list.size());//后续替换成实际的记录数
		laydata.setData(list);
		return laydata;
	}

	@Override
	public LayUiData<Record> getIsjobName(int page, int limit, String strLike) {
		// TODO Auto-generated method stub
		int start = (page - 1) * limit;
		LayUiData<Record> laydata = new LayUiData<Record>();
		laydata.setCode(0);
		laydata.setMsg("");
		List<Record> list = rs.getIsjobName(start, limit, strLike);
		laydata.setCount(list.size());//后续替换成实际的记录数
		laydata.setData(list);
		return laydata;
	}
	
	@Override
	public boolean addRecord(Record record) {
		// TODO Auto-generated method stub
		return rs.addRecord(record)>0;
	}
	
	@Override
	public boolean deleteRecord(int recordId) {
		// TODO Auto-generated method stub
		return rs.deleteRecord(recordId)>0;
	}

}
